from django.contrib import admin
from index import models

# 自定义模型管理类：显示方式，固件
class testAdmin(admin.ModelAdmin):
    list_per_page = 5  # 指定每页显示5条数据
    list_display = ['id', 'name', 'pub_date', 'age',
                    'phone', 'birth', 'tele', 'password', 'sex']
    action_on_bottom = True
    action_on_top = False
    search_fields = ['id']  # 列表上方搜索栏
    list_filter = ['sex']  # 列表右侧过滤栏

class testStudent(admin.ModelAdmin):
    list_display = ['id','sname','cid','detail']

class testStudentDetail(admin.ModelAdmin):
    list_display = ['id','height','email','memo']

class testClass(admin.ModelAdmin):
    list_display = ['id','cname','cdata']

class testArticle(admin.ModelAdmin):
    list_display = ['id','title','content']

# Register your models here.
admin.site.register(models.Test, testAdmin)  # 添加数据库表到后台管理系统,Test为表名
admin.site.register(models.Student,testStudent)
admin.site.register(models.StudentDetail,testStudentDetail)
admin.site.register(models.Class,testClass)
admin.site.register(models.Teacher)
admin.site.register(models.Article,testArticle)